<?php 
    require_once ("Includes/simplecms-config.php"); 
    require_once  ("Includes/connectDB.php");
    require_once ("Functions/printscores.php");
    include("Includes/header.php");         
?>
    <div id="main">
    <?php
        //mysqli_report(MYSQLI_REPORT_ALL);        

        $meetid = $_GET['meetid'];
        $query = 'SELECT meets.date, meets.name FROM meets '.
                 'WHERE meets.id = ? LIMIT 1';
        $statement = $databaseConnection->prepare($query);
        $statement->bind_param('s', $meetid);
        $statement->execute();
        if ($statement->error)
            die('Database query failed: ' . $statement->error);

        $statement->store_result();
        if ($statement->num_rows == 0)
            die ("Error: Meet doesn't exist");

        $statement->bind_result($meetdate, $name);
        $statement->fetch();
        $meetdate = new DateTime ($meetdate)
    ?>
    <h3><?php echo $name.' - '. $meetdate->format('m/d/Y'); ?>:</h3>
        <?php printScoresByMeet($meetid, $databaseConnection); ?>
    </div>

</div> <!-- End of outer-wrapper which opens in header.php -->

<?php 
    include ("Includes/footer.php");
?>